﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<IEnumerable<PhotoGalleryEnteties.PhotoComment>>" %>
<%@ Import Namespace="PhotoGalleryEnteties" %>

    
     <% foreach (PhotoComment comment in Model ){%>

        <div class ="comment" >
            
        <div class="imgReference">
            <div>
                <img src="<%=comment.Author.Avatar!=null?Url.Action( "GetPhoto","Photo" ,new{id=comment.Author.Avatar.PhotoId ,photoType=PhotoType.ImageThumbnail } ): "/Content/index.jpg"  %>" alt="" />
      
            </div>
        </div>
              
             <div class="content">   
                 <p>
                     <b><%=Html.Encode( comment .Author.UserName ) %>: </b>
                     <span class="date"><%=String.Format( "{0:g}",comment.AdditionDate)  %> </span>
                 </p>
                
                 <p>
                    <%= Html.Encode(comment.Comment)  %>
                 </p>
                 
               </div> 
               <div class="clear"></div>
               <%if (ViewData["CurrentUserName"] != null){%>
                    <% =Html.ActionLink("Reply comment", "Create", new {id=comment.Photo.PhotoId ,replyId=comment.CommentId  },new{@class="reply"} )%>
                    <%--
                    <%if (string.Compare(comment.Author.UserName, (string)ViewData["CurrentUserName"], true) == 0){%>
                    <%=Html.ActionLink( "Delete comment","Delete",new{id=comment.CommentId } ) %>
                    <%}%> 
                    --%>
                 <%}%>
             <%Html.RenderPartial("Comments", comment.ChildComments);%>
        </div>
    <%}%>
     

  



